package cvi.com.reader.network;

import android.util.Log;

import com.orhanobut.hawk.Hawk;

import okhttp3.Interceptor;
import java.io.IOException;
import java.util.HashSet;

import okhttp3.Request;
import okhttp3.Response;

/**
 * Created by 梅涛 on 2020/11/16.
 */


public class ReceivedTokenInterceptor implements Interceptor {

    private String token; //用于添加的请求头

    @Override
    public Response intercept(Chain chain) throws IOException {

        Request.Builder builder = chain.request().newBuilder();
        HashSet<String> perferences = null;
        perferences = Hawk.get("token");
        if (perferences != null) {
            for (String cookie : perferences) {
                builder.addHeader("token", cookie);
            }
        }
        return chain.proceed(builder.build());
    }
    }




